<div ng-include="sys_html('layout/_header')"></div><div class="ncm-container">    <div ng-include="sys_html('layout/member/left-layout')"></div>     <div class="right-layout">        <div class="wrap">             <div ng-include="sys_html('layout/member/tabmenu')"></div> 
            <div class="member-cart-page fui-page" style="background:#fff">
                <div class='fui-content navbar cart-list' style="bottom: 4.8rem">
                    <div class='content-empty' ng-if="pagedata.list=='' || pagedata.list==null">
                        <i class='icon icon-cart'></i><br/>购物车空空如也~<br/>
                        <a ng-click="access_json('/index/')" class='btn btn-default-o external'>主人快去给我找点东西吧</a>
                    </div>
                        <div class="fui-list-group">
                                <div ng-repeat="g in pagedata.list" class="fui-list goods-item align-start" style="padding:1rem">
                                    <div class="fui-list-media" style="margin-top:23px">
                                        <input type="checkbox" ng-checked="g.selected==1" ng-click="pagedata.toogle_select(g)" name="checkbox" class="fui-radio fui-radio-danger cartmode check-item choose_goods" />
                                    </div>
                                    <div class="fui-list-media image-media">                                            <a ng-click="access_json('/goods.detail//id='+g.goodsid)" >                                                <img id="gimg_{{g.id}}" ng-src="{{tomedia(g.image) || '../core/resource/images/nopic.jpg'}}" class="round" style="height:2.5rem">                                            </a>                                        </div>                                        <div class="fui-list-inner">                                            <a ng-click="access_json('/goods.detail//id='+g.goodsid)">                                                <div class="text">                                                    {{g.title}}                                                </div>                                                    <div class="text cart-option cartmode">                                                        <div class="choose-option">{{g.optiontitle ||'无规格'}} <span class="num bold">{{g.weight || '0.210'}}kg x {{g.total}}</span></div>                                                    </div>                                            </a>                                        </div>                                        <div class='fui-list-angle' style="line-height:52px">                                            <div class="price" style="color:#666;font-weight: 200;">￥<span class='marketprice' style="color:red;font-weight: 400;">{{g.price || '0.00'}}</span>                                            </div>                                        </div>                                        <div class='fui-list-angle' style="margin-left: 25px;">                                            <div class="fui-number small" style="margin-top:16px">                                                <div ng-click="pagedata.minus(g)" class="minus">-</div>                                                <input class="num shownum" type="tel" name="" value="{{g.total}}"/>                                                <div ng-click="pagedata.plus(g)" class="plus ">+</div>                                            </div>
                                    </div>
                                </div>
                        </div>
                </div>
            </div>
                <div ng-if="pagedata.list!='' && pagedata.list!=null" class="cartmode" style="bottom: 2.4rem;position:relative;height:4rem;margin-top:0.8rem;">
                    <div class="fui-list noclick">
                        <div class="fui-list-media">
                            <label class="checkbox-inline checkall">
                                <input type="checkbox" name="checkbox" class="fui-radio fui-radio-danger "  onclick="var ck = this.checked;$('.choose_goods').each(function(){if(this.checked != ck){$(this).click();}});"/>&nbsp;全选
                            </label>
                        </div>
                        <div class="fui-list-inner">
                            <div class='subtitle'>合计：<span class="text-danger">￥</span><span class='text-danger totalprice' style="font-weight:600">{{pagedata.totalprice}}</span>
                            </div>
                            <div class='text'>不含运费</div>
                        </div>
                        <div class='fui-list-angle'>
                            <div class="btn btn-success" ng-click="access_json('order.create/')" ng-calss="{'btn-default disabled':pagedata.total<=0}" ng-calss="{'btn-danger':pagedata.total>0}">结算(<span class='total'>{{pagedata.total}}</span>)
                            </div>
                        </div>
                    </div>
                </div>
            
        </div>
    </div>
</div>
<div ng-include="sys_html('layout/_footer')"></div><script>scope.pagedata.list=[];scope.pagedata.get_list=function(first){			if(first){				//初次加载				scope.pagedata.page=1;				scope.pagedata.list=[];				scope.pagedata.loaded=false;				$('#loaded').hide();			}else if(!scope.pagedata.page){				scope.pagedata.page=1;			}else{				scope.pagedata.page++;			}			if(scope.pagedata.loaded){				return;			}			if(scope.pagedata.loading){				return;			}else{				scope.pagedata.loading=true;			}			$('#loading').show();$('#loadmore').hide();			var query='page='+scope.pagedata.page;			if(scope.page.query){				query+='&'+scope.page.query;			}			var more_query=scope.made_query(scope.pagedata.params);			if(more_query){				query+='&'+more_query;			}			scope.get_data(function(res){				if(res.list.length==0){					scope.pagedata.loaded=true;					scope.$evalAsync();					scope.pagedata.loading=false;					$('#loading').hide();					$('#loaded').show();					if(scope.pagedata.list.length==0){						$('#no_goods').show();					}					return;				}				res.list.forEach(function(v){					scope.pagedata.list.push(v);				});				scope.pagedata.loading=false;				scope.pagedata.refresh();				scope.$apply();				$('#loading').hide();				$('#loadmore').show();							},'',{'op':'getlist','query':query});}//首次加载scope.pagedata.get_list(true);//滑到页面底部时加载下一页scope.pagedata.scroll_bottom=function(){	if(!scope.pagedata.loaded && !scope.pagedata.loading){		scope.pagedata.get_list();	}}//减少scope.pagedata.minus=function(cart){	if(cart.total<=1){		return false;	}	if(cart.selected!=1){		cart.selected=1;	}	var params={		data:{'id':cart.id},		op:'minus',		callback:function(res){			console.log('minus success');			cart.total--;			scope.pagedata.refresh();			scope.$evalAsync();		}	};	console.log('minus');	scope.post_json(params);}//增加scope.pagedata.plus=function(cart){	if(cart.selected!=1){		cart.selected=1;	}	var params={		data:{'id':cart.id},		op:'plus',		callback:function(res){			console.log('plus success');			cart.total++;			scope.pagedata.refresh();			scope.$evalAsync();		}	};	console.log('plus');	scope.post_json(params);}//选择scope.pagedata.toogle_select=function(cart){	var selected=cart.selected==1?0:1;	var params={		data:{'id':cart.id,'selected':selected},		op:'select',		callback:function(res){			cart.selected=selected;			scope.pagedata.refresh();			scope.$evalAsync();		}	};	scope.post_json(params);}//刷新总数和总价scope.pagedata.refresh=function(){	var total=0,totalprice=0.00;	angular.forEach(scope.pagedata.list,function(cart){		if(cart.selected==1){			total+=parseInt(cart.total);			totalprice+=cart.total*cart.price;		}	});	var totalprice = totalprice.toString(); //将数字转换为字符串	var pos_decimal = totalprice.indexOf('.'); //小数点的索引值	 // 当整数时，pos_decimal=-1 自动补0  	if (pos_decimal < 0) {  			pos_decimal = totalprice.length;  			totalprice += '.';  	}	// 当数字的长度< 小数点索引+2时，补0  	while (totalprice.length <= pos_decimal + 2) {  			totalprice += '0';  	}  	scope.pagedata.total=total;	scope.pagedata.totalprice=totalprice;}	</script>
</div>
